<script setup lang="ts">
import { ref } from 'vue'
import { genFileId, ElMessage } from 'element-plus'
import { useRouter } from "vue-router";
import AddProjectOperateBox from '/src/components/AddProjectOperateBox.vue'
import AddProjectOperateButton from '/src/components/AddProjectOperateButton.vue'
import SlotsAddProjectOpt from '/src/components/SlotsAddProjectOpt.vue'

const router = useRouter();
const loading = ref(false)
const loadingText = ref('Lodding...')
const opeateParam = {
    opeateText:'已完成，总结...',
    opdateButtons:[
        {name:'尽调任务完结', methond:'taskCompletion'}
    ]
};

const taskCompletion = () => {
    loadingText.value = '正在完成尽调任务，请稍等...';
    // 开启loading
    loading.value = true;
    setTimeout(() => {
        // 关闭loading
        loading.value = false;
        ElMessage({
            message: '尽调任务小结成功!',
            type: 'success',
        })
        router.push('/addProject/upload')
    }, 2000);
}
</script>

<template>
    <SlotsAddProjectOpt
        :loading="loading"
        :loadingText="loadingText"
    >
        <div class="w-100">
            <!-- 操作区文本框 -->
            <AddProjectOperateBox :opeateText="opeateParam.opeateText"/>
            <!-- 操作区按钮组 -->
            <AddProjectOperateButton :opdateButtons="opeateParam.opdateButtons"
                @taskCompletion="taskCompletion"/>
        </div>
    </SlotsAddProjectOpt>
</template>

<style scoped></style>
